package spring.bean;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

class SingleBean {
	private static SingleBean singleBean=new SingleBean();
	private SingleBean(){}
	public static SingleBean newInstance(){
		return singleBean;
	}
	
	private String name="helloworld";
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}
public class SingleBeanTest {
	public static void main(String[] args) {
		ApplicationContext context=new ClassPathXmlApplicationContext("bean.xml", SingleBeanTest.class);
//		SingleBean bean=SingleBean.newInstance();
		SingleBean singleBean=(SingleBean) context.getBean("singleBean");
		System.out.println(singleBean.getName());
	}
}